package com.nandi.deviceinstall.util

import android.content.Context

import com.afollestad.materialdialogs.MaterialDialog
import com.nandi.deviceinstall.R


class ProgressDialog private constructor() {

    private var materialDialog: MaterialDialog? = null

    fun show(mContext: Context) {
        materialDialog = MaterialDialog.Builder(mContext)
                //                .title(R.string.progress_dialog_title)
                .content(R.string.progress_please_wait)
                .progress(true, 0)
                .cancelable(false)
                .progressIndeterminateStyle(false)
                .show()

    }

    fun dismiss() {
        materialDialog!!.dismiss()
    }

    companion object {

        @Volatile
        private var instance: ProgressDialog? = null

        fun getInstance(): ProgressDialog? {
            if (instance == null) {
                synchronized(ProgressDialog::class.java) {
                    if (instance == null) {
                        instance = ProgressDialog()
                    }
                }
            }
            return instance
        }
    }
}
